package Persistence;

/**
 *
 * @author kenneth
 */
public class PersistenceController {
    
    private DatabaseConnection dbConn;
    private UserMapper userMapper;
    private static PersistenceController instance;
    
    private PersistenceController() {
        dbConn = new DatabaseConnection();
        userMapper = new UserMapper(dbConn);
    }
    
    public static PersistenceController getInstance() {
        if(instance == null)
            instance = new PersistenceController();
        return instance;
    }
    
    public boolean authenticateUser(String email, String password) {
        return userMapper.authenticateUser(email, password);
    }
    
    public boolean registerUser(String email, String password) {
        return userMapper.registerUser(email, password);
    }
    
    public boolean resetPasswordFromUser(String email) {
        return userMapper.resetPasswordFromUser(email);
    }

}
